/**
 * 
 */
package de.cbf.cam.dsa.entity.edit.talent.persister.mock;

import java.util.Map;

import de.cbf.cam.dsa.entity.edit.talent.resolver.persister_interface.IServicePersister_EntityTalent;
import de.cbf.util.db.interfaces.exceptions.EntityLoadException;
import de.cbf.util.db.interfaces.exceptions.EntitySaveException;
import de.cbf.util.entity.facet.entities.EntityFacetReferences;
import de.cbf.util.entity.facet.persistence.mock.AbstractServicePersisterMock;
import de.cbf.util.uuidheader.entities.UUIDReference;
import de.cbf.util.uuidheader.interfaces.IUUIDHeader;

/**
 * @author Nebelritter
 *
 */
public class Service_PersisterMock_EntityTalent extends AbstractServicePersisterMock implements IServicePersister_EntityTalent{

	public static final String NAME = "Entity:Talent:Mock";
	
	/* (non-Javadoc)
	 * @see de.cbf.util.entity.facet.persistence.mock.AbstractServicePersisterMock#init()
	 */
	@Override
	protected void init() {		
		super.init();
		setDisplayName(NAME);
	}	
	
	
	@Override
	protected Class<? extends IUUIDHeader> getElementClass() {		
		return EntityFacetReferences.class;
	}

	@Override
	public void saveEntityTalent(EntityFacetReferences entityTalent,Map<String, Object> options) throws EntitySaveException {
		persistElement(entityTalent,options);		
	}

	@Override
	public EntityFacetReferences loadEntityTalent(UUIDReference reference) throws EntityLoadException {
		IUUIDHeader element = loadElement(reference);
		if (element instanceof EntityFacetReferences) {
			EntityFacetReferences entityFacetReferences = (EntityFacetReferences) element;
			return entityFacetReferences;
		} else {
			String err_msg = "entity of wrong type(expected "
					+ EntityFacetReferences.class.getSimpleName() + "): " + (element == null ? "null"
					: element.getClass().getSimpleName());
			throw new EntityLoadException(err_msg);
		}
	}



	
}
